#include <iostream>

int main() {
    void average(float *p, int n);
    void search(float (*p)[4], int n);
    float score[3][4] = {{99, 98, 97, 96}, {95, 94, 93, 92}, {91, 90, 89, 88}};
    average(*score, 12);
    search(score, 2);
    return 0;
}

void average(float *p, int n) {
    float * p_end;
    float sum = 0, aver;
    p_end = p + n - 1;      // p_end指向最后一个元素
    for (; p <= p_end; p++) {
        sum += (*p);
    }
    aver = sum / n;
    printf("%5.2f\n", aver);
}

void search(float (*p)[4], int n) {     // p是指向具有四个元素的一维数组的指针
    int i;
    printf("The score of NO.%d are: \n", n);
    for (i = 0; i < 4; i++) {
        printf("%5.2f\t", *(*(p + n) + i));
    }
    printf("\n");
}